<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2024/11/22
  Time: 14:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript">
    function register(){
        var username = Document.getElementById("username").value;
        var password = Document.getElementById("password").value;
        //json data
        var jsonData = {"username":username,"password":password}
        //json object
        var jsonObject = JSON.stringify(jsonData);

        $.ajax({
            url:'${pageContext.request.contextPath}/stu/register.do',
            contentType:'application/json;charset=utf-8',
            method:'post',
            data:jsonData,
            success:function (resp){
                alert(resp.username + ":" + resp.password);
            }
        });
    }
</script>
<html>
<head>
    <title>页面注册</title>
</head>
<body>
    用户名：<input type="text" name="username" id="username"><br>
    密码: <input type="text" name="password" id="password">
    <input type="button" value="注册" onclick="register();">
</body>
</html>
